var text;
var btn

 window.onload  = function () {
     text = document.getElementById('text');
     btn = document.getElementById('btn');

     if(localStorage.text){
         text.value = localStorage.text;
     }

     btn.onclick = function () {
         localStorage.text = text.value;
     }
 };